<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="renderer" content="webkit" />
		<meta name="robots" content="index, follow" />
		<title>提交报修单</title>
		<meta name="keywords" content="">
		<meta name="description" content="">
		<meta name="author" content="order by website" />
		<script type="text/javascript" src="__XIAOHE__/js/jquery.min.js"></script>
		<script type="text/javascript" src="__XIAOHE__/yuye/ajaxfileupload.js"></script>
		
		{include file="./index/public/share" /}
		<script src="__XIAOHE__/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
		 crossorigin="anonymous"></script>
		<script src="__XIAOHE__/js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="__XIAOHE__/css/bootstrap.min.css" media="screen" />
		<link rel="stylesheet" type="text/css" href="__XIAOHE__/css/style.css" />
		<link rel="stylesheet" type="text/css" href="__XIAOHE__/css/swiper.min.css" />


		<!-- 引入样式文件 -->
		<link rel="stylesheet" type="text/css" href="__XIAOHE__/yuye/index.css">
		<!-- 引入 Vue 和 Vant 的 JS 文件XiaoHe QQ496631085  -->
		<script src="__XIAOHE__/yuye/vue.min.js"></script>
		<script src="__XIAOHE__/yuye/vant.min.js"></script>
	</head>
	<body>
		<div class="row">
			<div class="col-xs-12" style="padding: 0;">
				<div class="Suggestions1" style="background-image: url(__XIAOHE__/images/Suggestions1.jpg);">
					<div class="Repair1">
						<div class="Repair1a">
							<img src="__XIAOHE__/images/Repair1.jpg" >
						</div>
						<div class="Repair1b">
							<input type="text" id="name" value="{$wxuser.name}"  placeholder="报修人员"/>
						</div>
					</div>
					
					<div class="Repair1">
						<div class="Repair1a">
							<img src="__XIAOHE__/images/Repair2.jpg" >
						</div>
						<div class="Repair1b">
							<input type="text" id="tel" value="{$wxuser.tel}" placeholder="联系电话"/>
						</div>
					</div>
					<div class="Repair1">
						<div class="Repair1a">
							<img src="__XIAOHE__/images/Repair3.jpg" >
						</div>
						<div class="Repair1b">
							<input type="text" id="ltdtel" value="{$wxuser.ltdtel}" placeholder="公司电话"/>
						</div>
					</div>
					<div class="Repair1">
						<div class="Repair1a">
							<img src="__XIAOHE__/images/Repair4.jpg" >
						</div>
						<div class="Repair1b">
							<input type="text" id="room" value="{$wxuser.room}" placeholder="房间号"/>
						</div>
					</div>
					<div class="Repair2">
						<div class="Repair1a">
							<img class="Repair1aimg" src="__XIAOHE__/images/Repair5.jpg" >报修内容
						</div>
						<div class="Repair1c">
							<textarea rows="" cols="" id="content" placeholder="例:窗户关不上"></textarea>
						</div>
					</div>
					<img class="img-responsive"  id="photoshow1" src="">
					<input type="file" name="file" id="file" onchange="uploadImg();"  >


				

		
			
				<!-- 
			
					<div class="btn">
						<button id="images" type="button">选择相册</button>
					</div> -->

					<div class="Suggestions1e">
						<button id="xiaohe" type="button">提交报修单</button>
					</div>


					<script>
						function uploadImg() {
						    // debugger;
						    if($("#file").val() != "") {
						        $.ajaxFileUpload({
						            type: "POST",
						            url:"http://yywl.wxjoi.com/api/yuye/upload",//后台接口
						            dataType: "json",
						            fileElementId:"file",  // 文件的id
						            success: function(data){
						                if(data.code > 0) {
						                    // js.showMessage("上传成功");
						                    // alert(data.data.url);
						                    // alert(data.code);
						                    $('#photoshow1').attr('src',data.data.url);
						                    //图片显示
						                    // $("#avatar").attr("value",d.data.url);
						                    // $("#avatarShow").attr("src",d.data.url);
						                }
						            },
						            error: function () {
						                alert("上传失败".data.msg);
						            },
						        });
						    } else {
						        alert("请先选择文件");
						    }
						}
					</script>


					<script type="text/javascript">
					

						$("#upload").click(function(){
							var localIds = '';
							var serverId = '';
							wx.chooseImage({
								count: 1, // 默认9
								sizeType: ['original'], // 可以指定是原图还是压缩图'compressed'，默认二者都有, 
								sourceType: ['album'], // 可以指定来源是'',相册还是相机，默认二者都有
								success: function (res) {
									  localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
									  $('#photoshow').attr("src",localIds);
							
							  			$.ajax({
								            type: 'post',
								            url: "api/yuye/upload",
								            data: new FormData($("#myform")[0]),
								            cache: false,
								            processData: false,
								            contentType: false,
								            success: function(data){
								            	alert(data);
								            }

									  	});
		
								}
								

							});

						});	

						$("#photo").click(function(){
							var localIds = '';
							var serverId = '';
							wx.chooseImage({
							  count: 1, // 默认9
							  sizeType: ['original'], // 可以指定是原图还是压缩图'compressed'，默认二者都有, 
							  sourceType: ['camera'], // 可以指定来源是'album',相册还是相机，默认二者都有
							  success: function (res) {
							  localIds = res.localIds; // 返回选定照片的本地ID列表，localId可以作为img标签的src属性显示图片
							  	


							  }
							});

							$('#photoshow').attr("src",localIds);
							alert(localIds);
						});	



						$("#xiaohe").click(function(){
						    $.post("/api/yuye/baoxiu",{
								name:$("#name").val(),
								tel:$("#tel").val(),
								ltdtel:$("#ltdtel").val(),
								room:$("#room").val(),
								content:$("#content").val(),
								image:$('#photoshow1').attr('src'),
							},function(data,status){
						        // alert("Data: " + data + "nStatus: " + status);
						        if(data.code>0){
						        	alert('提交成功');
						        	window.close();
						        }else{
						        	alert('提交失败：'+data.msg);
						        }
						    });
						});


					</script>

				</div>
			</div>
		</div>
	</body>
</html>
